package dao

import (
	"context"
	"go-shop-admin/internal/model"
)
import "gorm.io/gorm"

type AuthLoginLogDao struct {
	*gorm.DB
}

// NewAuthLoginLogDao 把init init_mysql的Db复制过来
func NewAuthLoginLogDao(ctx context.Context) *AuthLoginLogDao {
	return &AuthLoginLogDao{NewDBClient(ctx)}
}

// AuthLoginLogCreate 创建
func (d *AuthLoginLogDao) AuthLoginLogCreate(uc *model.AuthLoginLog) error {
	return d.DB.Model(&model.AuthLoginLog{}).Create(uc).Error
	//return d.DB.Model(&model.User{}).Create(&uc).Error  //一样可以添加
	//为何把参数 uc 更换成 uc *model.UserCreate就不行了？报错 go reflect: Field index out of range
	//zydh:因为会和前面的model(&model.User{})去字段映射，所以会报错reflect 映射错误
}
